package com.example.jogo2d;

import java.util.Random;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.graphics.Rect;



public class Asteroide extends GameObject{
	Paint paint = new Paint();
	private Bitmap bitmap_Asteroide;
	Rect rectAsteroide;
	 public int velocidade;
	 public int velocidade2;
	boolean colidiu=false;
	//double radu;
	Random random=  new Random();
	int[] PositionX={10,50,100,150,200};
	double RandomNum;
	int teste;
	Asteroide asteroide;
	public Asteroide() {
		// TODO Auto-generated constructor stub
	}
	
	public void desenharAsteroide(Canvas canvas,Context context,int RandomPosition)
	{
		
		
		//paint.setColor(Color.BLUE);
		bitmap_Asteroide=BitmapFactory.decodeResource(context.getResources(),R.drawable.asteroide_sprite);
		rectAsteroide = new Rect(0+RandomPosition,0+velocidade,50+RandomPosition,50+velocidade);
		
		if(rectAsteroide.intersect(Nave.rectNave))
		{
			
			colidiu=true;
			
		
		}else{
			if(!colidiu)
			{
			//canvas.drawRect(rectAsteroide, paint);
			canvas.drawBitmap(bitmap_Asteroide,null,rectAsteroide, paint);
			}
		
		}
		
		
		
	}
	public float  VelocidadeAsteroide()
	{
		velocidade2++;
		if(velocidade2>=20)
		{
		velocidade++;
		
		velocidade2=0;
		
		}
		return velocidade;
		
		
	}
	/*int RandomPosition()
	{
		
	RandomNum=Math.random()*5;
	//random 
	//RandomNum=random.nextInt(6);
	teste=PositionX[(int)RandomNum];
	return teste;
	}*/
	
	
	
}
